#ifndef _DEVICE_INLUDED_
#define _DEVICE_INLUDED_

#include "qt-proxy.hh"
#include "types.h"

struct Device
{
	QString file;
	QString diskModel;
	QString diskSerial;
	size_t  diskSize;
	QString fsType;
	size_t  fsSize;
	QString fsLabel;

	QString toString() const {
		QString res;
		res += QString("Linux Device: %1\n").arg(file);
		res += QString("Disk Model: %1\n").arg(diskModel);
		res += QString("Disk Serial: %1\n").arg(diskSerial);
		res += QString("Disk Size: %1\n").arg(diskSize);
		res += QString("File System Type: %1\n").arg(fsType);
		res += QString("File System Size: %1\n").arg(fsSize);
		res += QString("File System Label: %1\n").arg(fsLabel);
		return res;
	}
};

struct Keyword
{
	QString regexp;
	QList<QString> cs;
	
	QString toString(){
		QString res = QString("Word: %1 \n").arg(regexp);
		QString str;
		foreach(str, cs){
			res += str + "\n";
		}
		return res;
	}
};

struct Hit{
	QString path;
	Keyword k;
	QString context;
	
	QString toString(){
		QString res;
		res += QString("File: '%1' \n").arg(path);
		res += QString("Keyword: '%1' \n").arg(k.regexp);
		res += QString("Context: '%1' \n").arg(context).replace(QRegExp("$"), "");
		return res;
	}
};

struct Task{
	Device d;
	Keyword k;
	QList<QString> flist;
	
	QString toString(){
		QString res;
		res += "Device: \n" + d.toString() + "\n\n";
		res += "Keyword: \n" + k.toString() + "\n\n";
		res += "Files: \n";
		QList<QString>::iterator it;
		for(it = flist.begin(); it != flist.end(); it++)
			res += *it + "\n";

		return res;
	}
};

struct FileInfo{
	QDateTime ctime;
	QDateTime mtime;
	QDateTime dtime;
	size_t size;
	size_t blocks;
};

#endif //_DEVICE_INLUDED_
